package com.pengchuang.ACS.common.utils;

import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;

import java.io.Serializable;

@AllArgsConstructor
@NoArgsConstructor
public enum ResultCode implements IResultCode, Serializable {

    SUCCESS("200", "成功"),
    PARAM_VALID_FAIL("403", "参数校验不通过"),
    DATA_NOT_FOUND("404", "数据不存在"),
    SYSTEM_EXECUTION_ERROR("500", "系统执行出错"),
    USERNAME_OR_PASSWORD_ERROR("400", "用户名或密码错误"),
    USER_NOT_EXIST("404", "用户不存在"),
    CLIENT_AUTHENTICATION_FAILED("401", "客户端认证失败"),
    ACCESS_UNAUTHORIZED("401", "未授权"),
    TOKEN_INVALID_OR_EXPIRED("401", "token非法或失效"),
    TOKEN_ACCESS_FORBIDDEN("A00215", "token禁止访问"),
    FLOW_LIMITING("B0210", "系统限流"),
    DEGRADATION("B0220", "系统功能降级"),
    SERVICE_NO_AUTHORITY("B0221", "服务未授权"),
    PICTURE_ERROR("B0226", "图片上传有误"),
    PICTURE_ERROR_TYPE("B0227", "请选择 png、jpg、jpeg、gif、bmp 格式的图片"),
    PICTURE_ERROR_SIZE("B0228", "图片体积太大"),
    DOOR_ERROR("C0227", "终端机验证错误"),
    DOOR_NO_AUTH("D0001", "不存在该临时授权码"),
    FACE_ERROR("F0001", "人脸识别错误")
    ;

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMsg() {
        return msg;
    }

    private String code;

    private String msg;

    @Override
    public String toString() {
        return "{" +
                "\"code\":\"" + code + '\"' +
                ", \"msg\":\"" + msg + '\"' +
                '}';
    }

}